<?php
$di = \Phalcon\Di::getDefault();
$output = array(
    '_id' => 'search',
    '_form' => array(
        'method' => 'post',
        'class' => 'searchform',
        'accept-charset' => 'utf-8',
        'role' => 'search',
        'id' => 'search',
    ),
    'type' => array(
        'label' => '类型',
        'error' => '',
        'description' => '搜索类型',
        'field' => 'string',
        'widget' => 'Select',
        'options' => [],
        'attributes' => [],
        'required' => true,
    ),
    'word' => array(
        'label' => '关键字',
        'error' => '',
        'description' => '关键字',
        'widget' => 'Text',
        'validate' => array(
        ),
        'attributes' => array(
            'class' => 'search-input',
            'placeholder' => '吭～ 知之为知之，不知搜一下',
        ),
        'required' => true,
    ),
    '_options' => array(
        'checkToken' => false,
        'validation' => true,
        'save' => 'Modules\Search\Library\Common::defaultSearch'
    ),
);
$typeOptions = [];
foreach ($di->getShared('config')->cache('searchProject') as $key => $engine){
    if(isset($engine['handle']) && $engine['handle'] == 'default') {
        $typeOptions[$key] = $engine['name'];
    }
}
$output['type']['options'] = $typeOptions;
return $output;